
var timer = null
export function countDown(endTtime) {
    var leftTime = (new Date(endTtime)) - (new Date()); //计算剩余的毫秒数
    var days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数
    var hours = parseInt(leftTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时
    var minutes = parseInt(leftTime / 1000 / 60 % 60, 10);//计算剩余的分钟
    var seconds = parseInt(leftTime / 1000 % 60, 10);//计算剩余的秒数
    days = bu(days);
    hours = bu(hours);
    minutes = bu(minutes);
    seconds = bu(seconds);
    var result = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒"
    if (seconds == '00') {
        clearInterval(timer)
    }
    return result
}
export function setIntervalCount(endTtime) {

    timer = setInterval(() => {
        countDown(endTtime)
    }, 1000);
}
function bu(n) {
    if (n < 10) {
        n = '0' + n;
    }
    return n;
}
export function baseUrl() {
    var baseUrl='http://120.76.58.119:7081/byjz-ia' // 生产环境
    // var baseUrl='http://192.168.1.100:7081/byjz-ia' //测试环境
    return baseUrl
}
